home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / PowerMacOberon feb96 / Source / Display1.Mod (.txt) < prev    next >
Oberon Text  |  1994-07-11  |  3KB  |  57 lines

  1. Syntax10.Scn.Fnt
  2. MODULE Display1; (*mf 9.3.93*)
  3.     IMPORT
  4.         SYS := SYSTEM, Macintosh, Display;
  5.     CONST
  6.         white=0; grey1=1; grey2=2; grey3=3; grey4=4; black=5; texture0=6; texture1=7; texture2=8; texture3=9;
  7.         scrPat: ARRAY 10 OF Display.Pattern;
  8.     PROCEDURE Line*(F: Display.Frame; col, x0, y0, x1, y1, mode: INTEGER);
  9.     BEGIN Macintosh.SetUserClip(F.X, Display.Height-F.Y, F.W, F.H);
  10.         Macintosh.SetPenScreen(F.Y>=0, Macintosh.userClip, col, mode); Macintosh.Line(x0, Display.Height-1-y0, x1, Display.Height-1-y1)
  11.     END Line;
  12.     PROCEDURE Circle*(F: Display.Frame; col, x, y, r, mode: INTEGER);
  13.     BEGIN Macintosh.SetUserClip(F.X, Display.Height-F.Y, F.W, F.H);
  14.         Macintosh.SetPenScreen(F.Y>=0, Macintosh.userClip, col, mode); Macintosh.Circle(x, Display.Height-y, r)
  15.     END Circle;
  16.     PROCEDURE Ellipse*(F: Display.Frame; col, x, y, a, b, mode: INTEGER);
  17.     BEGIN Macintosh.SetUserClip(F.X, Display.Height-F.Y, F.W, F.H);
  18.         Macintosh.SetPenScreen(F.Y>=0, Macintosh.userClip, col, mode); Macintosh.Ellipse(x, Display.Height-y, a, b)
  19.     END Ellipse;
  20.     PROCEDURE NewPattern*(VAR image: ARRAY OF SET; w, h: INTEGER): Display.Pattern;
  21.     BEGIN RETURN SYS.VAL(Display.Pattern, Macintosh.NewPatMap(image, w, h, 0))
  22.     END NewPattern;
  23.     PROCEDURE GetPatternSize*(pat: Display.Pattern; VAR w, h: INTEGER);
  24.     BEGIN Macintosh.GetPatSize(pat, w, h)
  25.     END GetPatternSize;
  26.     PROCEDURE ThisPattern*(n: INTEGER): Display.Pattern;
  27.     BEGIN RETURN scrPat[n]
  28.     END ThisPattern;
  29.     PROCEDURE InitPat;
  30.         VAR img: ARRAY 10 OF SET;
  31.     BEGIN
  32.             img[1] := {};
  33.         scrPat[white] := Display.NewPattern(img, 32, 1);
  34.             img[4] := {0, 8, 16, 24}; img[3] := {}; img[2] := {4, 12, 20, 28}; img[1] := {};
  35.         scrPat[grey1] := Display.NewPattern(img, 32, 4);
  36.             img[2] := {0, 4, 8, 12, 16, 20, 24, 28}; img[1] := {2, 6, 10, 14, 18, 22, 26, 30};
  37.         scrPat[grey2] := Display.NewPattern(img, 32, 2);
  38.             img[2] := {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30}; img[1] := {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31};
  39.         scrPat[grey3] := Display.NewPattern(img, 32, 2);
  40.             img[2] := {1..3, 5..7, 9..11, 13..15, 17..19, 21..23, 25..27, 29..31}; img[1] := {0, 1, 3..5, 7..9, 11..13, 15..17, 19..21, 23..25, 27..29, 31};
  41.         scrPat[grey4] := Display.NewPattern(img, 32, 2);
  42.             img[1] := {0..31};
  43.         scrPat[black] := Display.NewPattern(img, 32, 1);
  44.             img[4]  := {3, 7, 11, 15, 19, 23, 27, 31}; img[3]  := {2, 6, 10, 14, 18, 22, 26, 30};
  45.             img[2]  := {1, 5, 9, 13, 17, 21, 25, 29}; img[1]  := {0, 4, 8, 12, 16, 20, 24, 28};
  46.         scrPat[texture0] := Display.NewPattern(img, 32, 4);
  47.             img[4]  := {0, 4, 8, 12, 16, 20, 24, 28}; img[3]  := {1, 5, 9, 13, 17, 21, 25, 29};
  48.             img[2]  := {2, 6, 10, 14, 18, 22, 26, 30}; img[1]  := {3, 7, 11, 15, 19, 23, 27, 31};
  49.         scrPat[texture1] := Display.NewPattern(img, 32, 4);
  50.             img[1] := {2, 6, 10, 14, 18, 22, 26, 30};
  51.         scrPat[texture2] := Display.NewPattern(img, 32, 1);
  52.             img[4] := {}; img[3] := {}; img[2] := {}; img[1] := {0..31};
  53.         scrPat[texture3] := Display.NewPattern(img, 32, 4)
  54.     END InitPat;
  55. BEGIN InitPat
  56. END Display1.
  57.